import * as constant from './constant';
import { fromJS } from 'immutable';

const defaultState = fromJS({
  isFocus: false,
  list: []
});

export default (state = defaultState, action) => {
  switch (action.type) {
      case constant.SEARCH_FOCUS:
          return state.set('isFocus', true);
      case constant.SEARCH_BLUR:
          return state.set('isFocus', false);   
      case constant.CHANGE_LIST:
      return state.set('list', action.data);  
  default:
    return state;
  };
}